/** query *********************************************/
export class DbQuery {
    public dbType!: string;
    public ip!: string;
    public port!: string;
    public db!: string;
    public username!: string;
    public password!: string;
}

export class DbTableQuery extends DbQuery {}

export class DbColumnQuery extends DbQuery {
    public table!: string;
}

/** form *********************************************/
export class TemplateParamForm {
    public entityParam?: EntityTemplateParam;
    public modelParam?: ModelTemplateParam;
    public daoParam?: DaoTemplateParam;
    public managerParam?: ManagerTemplateParam;
    public serviceParam?: ServiceTemplateParam;
    public controllerParam?: ControllerTemplateParam;
    public uiParam?: UiTemplateParam;
}

export class BaseTemplateParam {
    public projectPath: string = 'F:/Code/Company/2021_registration_sys/service';
    public author!: string;
    public extennsionName!: string;
    public classPrefix!: string;
    public objectPrefix!: string;
    public entityBasePackage: string = 'com.ydfuture.ses.data.entity';
    public daoBasePackage: string = 'com.ydfuture.ses.service.mapper';
    public modelBasePackage: string = 'com.ydfuture.ses.data.model';
    public managerBasePackage: string = 'com.ydfuture.ses.service.manager';
    public serviceBasePackage: string = 'com.ydfuture.ses.service.service';
    public controllerBasePackage: string = 'com.ydfuture.ses.web.controller';
    public relativePackage!: string;
}

export class EntityField {
    public name!: string;
    public type!: string;
    public comment!: string;
}

export class EntityTemplateParam extends BaseTemplateParam {
    public fieldList: EntityField[] = [];
}

export class ModelTemplateParam extends BaseTemplateParam {
    public fieldList: EntityField[] = [];
}

export class DaoTemplateParam extends BaseTemplateParam {}

export class ManagerTemplateParam extends BaseTemplateParam {}

export class ServiceTemplateParam extends BaseTemplateParam {}

export class ControllerTemplateParam extends BaseTemplateParam {
    public tag!: string;
    public url!: string;
}

export class UiTemplateParam {
    public projectPath: string = 'F:/Code/MH/minghe/minghe_ui/';
    public relativePath!: string;
    public classPrefix!: string;
    public objectPrefix!: string;
    public name!: string;
    public requestRelativeUrl!: string;
}

/** dto *********************************************/
export class DbColumnDTO {
    public orderIndex!: number;
    public columnName!: string;
    public columnType!: string;
    public nullable!: boolean;
    public comment!: string;
    public field!: string;
    public javaType!: string;

    public static columns = [
        {
            title: '列名',
            dataIndex: 'columnName',
            width: 200,
        },
        {
            title: '类型',
            dataIndex: 'columnType',
            width: 200,
        },
        {
            title: '备注',
            dataIndex: 'comment',
        },
        {
            title: '对应字段名',
            dataIndex: 'field',
            width: 200,
        },
        {
            title: '对应Java类型',
            dataIndex: 'javaType',
            width: 200,
        },
    ];
}
